<?php
// +----------------------------------------------------------------------
// |
// +----------------------------------------------------------------------
// |
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// |
// +----------------------------------------------------------------------

namespace app\model;

use \think\Model;

class AgentAudit extends Model
{
    protected $name = 'agent_audit';
    protected $autoWriteTimestamp = true;
    protected $insert = [];
    protected $update = [];

    public function agent()
    {
        return $this->belongsTo(AdminAgent::class, 'agent_id')
            ->bind([
                'agent_name' => 'name',
            ]);
    }

    public function shop()
    {
        return $this->belongsTo(AgentShop::class, 'appid', 'appid')
            ->bind([
                'product_number' => 'product_number',
                'settle_amount'  => 'settle_amount',
                'ratio'          => 'ratio',
                'approved_time'  => 'approved_time',
            ]);
    }
}
